package pnu.ssm.genetic.algorithm;

public class GA {
	public static void main(String[] args) {
		// Set a candidate solution
		FitnessCalc.setSolution("1111000000000000000000000000000000000000000000000000000000001111");
		// 이 알고리즘은 미리 Solution을 정한다. 이 Solution가 Fitness의 기준이다.
		
		// Create an initial population
		Population myPop = new Population(50, true);
		
		// Evolve our population until we reach an optimum solution
		int generationCount = 0;
		while(myPop.getFittest().getFitness() < FitnessCalc.getMaxFitness()){
			generationCount++;
			System.out.println("Generation: " + generationCount + " Fittest: " + myPop.getFittest().getFitness());
			myPop = Algorithm.evolvePopulation(myPop);
		}
		System.out.println("Solution found!");
		System.out.println("Generation: " + generationCount);
		System.out.println("Genes: ");
		System.out.println(myPop.getFittest());
	}
}







